<?php
require("../../class/connect.php");
include("../../class/config.php");
include("../../class/db_sql.php");
include("../../class/q_functions.php");
include("../../class/user.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//是否登陆
$user=islogin();
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$line=25;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$start+$page*$line;//总偏移量
$totalquery="select count(*) as total from {$dbtbpre}enewsbuybak where userid='$user[userid]'";
$num=$empire->gettotal($totalquery);//取得总条数
$query="select * from {$dbtbpre}enewsbuybak where userid='$user[userid]'";
$query=$query." order by buytime desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp>控制面板</a>&nbsp;>&nbsp;我的购买记录";
@include("../../data/template/cp_1.php");
?> 
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="15%" valign="top"> <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
        <tr class="header"> 
          <td height="23">消费记录</td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="../buybak">点卡充值记录</a></td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="../downbak">下载消费记录</a></td>
        </tr>
      </table></td>
    <td width="1%" valign="top">&nbsp;</td>
    <td width="84%" valign="top"> 
      <div align="center">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
          <tr class="header"> 
            <td width="34%" height="25"><div align="center">充值卡号</div></td>
            <td width="21%" height="25"><div align="center">冲值金额</div></td>
            <td width="18%" height="25"><div align="center">购买点数</div></td>
            <td width="27%" height="25"><div align="center">购买时间</div></td>
          </tr>
          <?
  while($r=$empire->fetch($sql))
  {
	  //包月天数
	  if($r[userdate])
	  {
		  $r[cardfen]=$r[userdate]." 天";
	  }
	  else
	  {
		  $r[cardfen]=$r[cardfen]." 点";
	  }
  ?>
          <tr bgcolor="#FFFFFF"> 
            <td height="25"><div align="center"> 
                <?=$r[card_no]?>
              </div></td>
            <td height="25"><div align="center"> 
                <?=$r[money]?>
              </div></td>
            <td height="25"><div align="center"> 
                <?=$r[cardfen]?>
              </div></td>
            <td height="25"><div align="center"> 
                <?=$r[buytime]?>
              </div></td>
          </tr>
          <?
  }
  db_close();
  $empire=null;
  ?>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" colspan="4"> 
              <?=$returnpage?>
            </td>
          </tr>
        </table>
      </div></td>
  </tr>
</table>
<?
@include("../../data/template/cp_2.php");
?>